#pragma once
#ifndef __VIEW_H__
#define __VIEW_H__
#include "button_event.h"
#include "finished_product.h"
typedef enum __view_level_t
{
    view_level_0,
    view_level_1,
    view_level_2,
} view_level_t;
#define VIEW_LEVEL_0_SUB_COUNT (100)
#define VIEW_LEVEL_1_SUB_COUNT (10)
#define VIEW_LEVEL_2_SUB_COUNT (1)
typedef enum __View_level_0
{
    View_level_0_time,
    View_level_0_heart_rate,
    View_level_0_steps,
    View_level_0_calories,
    View_level_0_others,
#ifdef NO_OUTDOORS_UI
#else
    View_level_0_outdoors,
#endif
    View_level_0_metronome,
    View_level_0_relax,
    View_level_0_music,
    View_level_0_sports,
    View_level_0_end,
} View_level_0;
#define VIEW_DEFINE(name) view_##name = view_start + View_level_0_##name * VIEW_LEVEL_0_SUB_COUNT
typedef enum __view_t
{
    view_empty,
    view_untested,
    view_close_oled,
    view_screen_test,
    view_power_off_animation,
    view_power_on_animation,
    view_heart_rate_test,
    view_heart_rate_result,
    view_finished_product_start,
    view_finished_product_end,
    view_normal_start,
    view_start = VIEW_LEVEL_0_SUB_COUNT,
    VIEW_DEFINE(time),
    VIEW_DEFINE(heart_rate),
    VIEW_DEFINE(steps),
    VIEW_DEFINE(calories),
    VIEW_DEFINE(others),
#ifdef NO_OUTDOORS_UI
#else
    VIEW_DEFINE(outdoors),
#endif
    VIEW_DEFINE(metronome),
    VIEW_DEFINE(relax),
    VIEW_DEFINE(music),
    VIEW_DEFINE(sports),
    VIEW_DEFINE(end),
    view_normal_end,
    view_prompt_start,
    view_prompt_not_connect = view_prompt_start,
    view_prompt_distance_complete,
    view_prompt_calories_complete,
    view_prompt_steps_complete,
    view_prompt_music_not_connect,
    view_prompt_lost,
    view_prompt_drink,
    view_prompt_sedentariness,
    view_prompt_low_power,
    view_prompt_charing,
    view_prompt_finding,
    view_prompt_not_wear,
    view_prompt_message,
    view_prompt_bind_success,
    view_prompt_camera_ready,
    view_prompt_camera_fail,
    view_prompt_priority_alert_end,
    view_prompt_alarm = view_prompt_priority_alert_end,
    view_prompt_end,
    view_not_used,
    // view_finished_product_test_start,
    // view_finished_product_manual_test_start = view_finished_product_test_start,
    // view_finished_product_charge_wait,      //!<还未进行充电
    // view_finished_product_touch_wait,       //!<还未触摸
    // view_finished_product_button_0_wait,    //!<还未按键1
    // view_finished_product_button_1_wait,    //!<还未按键2
    // view_finished_product_button_2_wait,    //!<还未按键3
    // view_finished_product_gsensor_wait,     //!< 还未晃动三轴
    // view_finished_product_geomagnetic_wait, //!< 还未晃动地磁
    // view_finished_product_heart_rate_wait,  //!< 还未放在手上测量心率
    // view_finished_product_not_wear_wait,    //!< 还未对空测试
    // view_finished_product_manual_test_end,
    // view_finished_product_device_communication_test_start = view_finished_product_manual_test_end,
    // view_finished_product_touch_fail,                   //!<触摸通讯失败
    // view_finished_product_touch_int_fail,               //!<触摸一直有值
    // view_finished_product_gsensor_fail,                 //!<触摸三轴通讯失败
    // view_finished_product_flash_fail,                   //!< flash 通讯失败
    // view_finished_product_flash_id_fail,                //!< flash 型号不对
    // view_finished_product_photoplethysmography_fail,    //!<心率通讯失败
    // view_finished_product_photoplethysmography_id_fail, //!< 心率 型号不对
    // view_finished_product_pressure_fail,                //!<气压通讯失败
    // view_finished_product_pressure_id_fail,             //!< 气压型号不对
    // view_finished_product_geomagnetic_fail,             //!<地磁通讯失败
    // view_finished_product_geomagnetic_id_fail,          //!< 地磁型号不对
    // view_finished_product_device_communication_test_end,
    // view_finished_product_test_end,
} view_t;
typedef enum __view_metronome_sub_t
{
    view_metronome_base = view_metronome,
    view_metronome_state = view_metronome_base + VIEW_LEVEL_1_SUB_COUNT,
    view_metronome_option,
} view_metronome_sub_t;
typedef enum __view_music_sub_t
{
    view_music_base = view_music,
    view_music_state = view_music_base + VIEW_LEVEL_1_SUB_COUNT,
} view_music_sub_t;
typedef enum __view_relax_sub_t
{
    view_relax_base = view_relax,
    view_relax_home = view_relax_base + VIEW_LEVEL_1_SUB_COUNT,
    view_relax_tips,
    view_relax_animation,
    view_relax_animation_end,
    view_relax_option_time = view_relax_home + VIEW_LEVEL_1_SUB_COUNT,
    view_relax_option_shock,
    view_relax_option_time_set,
} view_relax_sub_t;
typedef enum __view_time_sub_t
{
    view_time_base = view_time,
    view_time_message = view_time_base + VIEW_LEVEL_1_SUB_COUNT,
} view_time_sub_t;

typedef enum __view_others_sub_t
{
    view_others_base = view_others,
    view_others_level_1_begin = view_others_base + VIEW_LEVEL_1_SUB_COUNT,
    view_others_camera = view_others_level_1_begin,
    view_others_camera_static,
    view_others_camera_shake,
    view_others_stopwatch = view_others_camera + VIEW_LEVEL_1_SUB_COUNT,
    view_others_stopwatch_state,
    view_others_device_info = view_others_stopwatch + VIEW_LEVEL_1_SUB_COUNT,
    view_others_device_info_detail,
    view_others_app_url = view_others_device_info + VIEW_LEVEL_1_SUB_COUNT,
    view_others_power_off = view_others_app_url + VIEW_LEVEL_1_SUB_COUNT,
    view_others_power_off_confirm,
    view_others_level_1_end = view_others_power_off + VIEW_LEVEL_1_SUB_COUNT,
} view_others_sub_t;
#ifdef NO_OUTDOORS_UI
#else
typedef enum __view_outdoors_sub_t
{
    view_outdoors_base = view_outdoors,
    view_outdoors_level_1_begin = view_outdoors_base + VIEW_LEVEL_1_SUB_COUNT,
    view_outdoors_altitude = view_outdoors_level_1_begin,
    view_outdoors_altitude_options,
    view_outdoors_altitude_set_0,
    view_outdoors_altitude_set_1,
    view_outdoors_temperature = view_outdoors_altitude + VIEW_LEVEL_1_SUB_COUNT,
    view_outdoors_pressure = view_outdoors_temperature + VIEW_LEVEL_1_SUB_COUNT,
#ifdef USE_GEOMAGNETISM
    view_outdoors_geomagnetism = view_outdoors_pressure + VIEW_LEVEL_1_SUB_COUNT,
    view_outdoors_level_1_end = view_outdoors_geomagnetism + VIEW_LEVEL_1_SUB_COUNT,
#else
    view_outdoors_level_1_end = view_outdoors_pressure + VIEW_LEVEL_1_SUB_COUNT,
#endif
} view_outdoors_sub_t;
#endif
typedef enum __view_sports_sub_t
{
    view_sports_base = view_sports,
    view_sports_error_short,
    view_sports_level_1_begin = view_sports_base + VIEW_LEVEL_1_SUB_COUNT,
    view_sports_runing = view_sports_level_1_begin,
    view_sports_runing_ready,
    view_sports_walking = view_sports_runing + VIEW_LEVEL_1_SUB_COUNT,
    view_sports_walking_ready,
    view_sports_cycling = view_sports_walking + VIEW_LEVEL_1_SUB_COUNT,
    view_sports_cycling_ready,
    view_sports_fitness = view_sports_cycling + VIEW_LEVEL_1_SUB_COUNT,
    view_sports_fitness_ready,
    view_sports_swing = view_sports_fitness + VIEW_LEVEL_1_SUB_COUNT,
    view_sports_swing_ready,
    view_sports_basketball = view_sports_swing + VIEW_LEVEL_1_SUB_COUNT,
    view_sports_basketball_ready,
    view_sports_football = view_sports_basketball + VIEW_LEVEL_1_SUB_COUNT,
    view_sports_football_ready,
#ifdef SPORTS_SWIM
    view_sports_swim = view_sports_football + VIEW_LEVEL_1_SUB_COUNT,
    view_sports_swim_ready,
    view_sports_level_1_end = view_sports_swim + VIEW_LEVEL_1_SUB_COUNT,
#else
    view_sports_level_1_end = view_sports_football + VIEW_LEVEL_1_SUB_COUNT,
#endif
    view_sports_state_begin = view_sports_level_1_end,
    view_sports_state_0,
    view_sports_state_1,
    view_sports_state_2,
    view_sports_state_3,
    view_sports_state_end,
    view_sports_result_start = view_sports_state_end,
    view_sports_result_0,
    view_sports_result_1,
    view_sports_result_end,
    view_sports_paused,
    view_sports_prompt_end = view_sports_result_0,

} view_sports_sub_t;
typedef enum __view_compatibility_t
{
    DISP_TYPE_DISTANCE_COMPLETE = view_prompt_distance_complete,
    DISP_TYPE_CALORIE_COMPLETE = view_prompt_calories_complete,
    DISP_TYPE_STEP_COMPLETE = view_prompt_steps_complete,
    // DISP_TYPE_PRODUCT_NOT_PASS = view_untested,
    DISP_TYPE_CLOSE_OLED = view_close_oled,
    DISP_TYPE_LOST_ALERT = view_prompt_lost,
    DISP_TYPE_DRINK_ALERT = view_prompt_drink,
    DISP_TYPE_ALARM_CLOCK = view_prompt_alarm,
    DISP_TYPE_SITLONG_ALERT = view_prompt_sedentariness,
    DISP_TYPE_FULL_SCREEN = view_screen_test,
    DISP_TYPE_LOWPOWER_ALERT = view_prompt_low_power,
    DISP_TYPE_CHARGING = view_prompt_charing,
    DISP_TYPE_CAMERA_SUB = view_others_camera_static,
    DISP_TYPE_CAMERA = view_others_camera,
    // view_power_off_animation = view_power_off_animation,
    DISP_TYPE_LOOKBAND = view_prompt_finding,
    DISP_TYPE_HR_TEST_NOT_WEAR = view_prompt_not_wear,
    DISP_TYPE_ANCS = view_prompt_message,
    DISP_TYPE_BIND_COMPLETE = view_prompt_bind_success,
} view_compatibility_t;

void view_display(void);
void view_event(event_param_t);
void event_level_up_broadcast(void);
void event_next_view_broadcast(void);
bool is_view_exit_to_empty(int view);
typedef enum
{
    HOME_PAGE_TYPE_0,
    HOME_PAGE_TYPE_1,
    HOME_PAGE_TYPE_2,
    HOME_PAGE_TYPE_3,
    HOME_PAGE_TYPE_4,
    HOME_PAGE_TYPE_5,
    HOME_PAGE_TYPE_6,
    HOME_PAGE_TYPE_7,
    HOME_PAGE_TYPE_8,
    HOME_PAGE_TYPE_9,
    HOME_PAGE_TYPE_10,
    HOME_PAGE_TYPE_11,
    HOME_PAGE_TYPE_12,
    HOME_PAGE_TYPE_13,
    HOME_PAGE_TYPE_14,
    HOME_PAGE_TYPE_15,
    HOME_PAGE_TYPE_16,
    HOME_PAGE_TYPE_17,
    HOME_PAGE_TYPE_18,
    HOME_PAGE_TYPE_19,
    HOME_PAGE_TYPE_20,
    HOME_PAGE_TYPE_21,
    HOME_PAGE_TYPE_22,
    HOME_PAGE_TYPE_23,
    HOME_PAGE_TYPE_END,
} home_page_type_t;
#endif //!<__VIEW_H__
